﻿// Copyright 2010 Maxime Serrano <lastchronicler@gmail.com>
using System;
using System.IO;

namespace MCSharp.Network.Handlers
{
    public class DisconnectHandler : PacketHandler
    {
        #region PacketHandler Members

        public void Handle(BinaryReader reader, Session session, Player player)
        {
            string reason = PacketReader.ReadString(reader);
            Logger.Log("Player {0} disconnected. ({1})", LogType.UserActivity, player.name, reason);
            player.DisconnectReason = reason;
            session.KickNow(reason);
        }

        #endregion
    }
}
